
#ifndef OSHeaders_H
#define OSHeaders_H

#include <limits.h>
#include "PlatformHeader.h"


#ifndef TRUE
    #define TRUE 1
#endif

#ifndef FALSE
    #define FALSE 0
#endif



/* Platform-specific components */
#if __linux__			//for Linux  Platform

#define kInt16_Max SHRT_MAX
#define kUInt16_Max USHRT_MAX
#define kInt32_Max LONG_MAX
#define kUInt32_Max ULONG_MAX
#define kInt64_Max 0xFFFFFFFFFFFFFFFFLL
#define kUInt64_Max 0xFFFFFFFFFFFFFFFFULL

    #define _64BITARG_ "q"    

    /* paths */
    #define kEOLString "\n"
    #define kPathDelimiterString "/"
    #define kPathDelimiterChar '/'
	#define kBadPathDelimiterStr "\\"
	#define kBadPathDelimiterChar '\\'
    #define kPartialPathBeginsWithDelimiter 0

    /* Includes */
	#include <sys/types.h>
	#include <netinet/in.h>
	#include <sys/socket.h>
	#include <netinet/in.h>
	#include <arpa/inet.h>
	#include <unistd.h>
    
    /* Constants */
    #define QT_TIME_TO_LOCAL_TIME   (-2082844800)
    #define QT_PATH_SEPARATOR       '/'

    /* Typedefs */
    typedef UInt32        PointerSizedInt;
    typedef unsigned char       UInt8;
    typedef unsigned char       UChar;
    typedef signed char         Int8;
    typedef  char         Char;
    typedef unsigned short      UInt16;
    typedef signed short        Int16;
    typedef unsigned long       UInt32;
    typedef signed long         Int32;
    typedef signed long long    Int64;
    typedef unsigned long long  UInt64;
    typedef float               Float32;
    typedef double              Float64;
    typedef UInt32              Bool;
	


    typedef unsigned long       FourCharCode;
    typedef FourCharCode        OSType;
    typedef pthread_t		THREAD_ID;
    typedef pid_t		PID;

    #ifdef  FOUR_CHARS_TO_INT
    #error	Conflicting Macro "FOUR_CHARS_TO_INT"
    #endif

    #define FOUR_CHARS_TO_INT( c1, c2, c3, c4 )  ( c1 << 24 | c2 << 16 | c3 << 8 | c4 )
	#define FOUR_CHARS_TO_INT2( s )  ( s[3] << 24 | s[2] << 16 | s[1] << 8 | s[0] )

    #ifdef  TW0_CHARS_TO_INT
    #error Conflicting Macro "TW0_CHARS_TO_INT"
    #endif
        
    #define TW0_CHARS_TO_INT( c1, c2 )  ( c1 << 8 | c2 )

	//Linux platform
	#define BIGENDIAN       0
	#define kPlatformNameString     "Linux"
	#define EXPORT

#elif WIN32				//for Windows Platform

#define kInt16_Max SHRT_MAX
#define kUInt16_Max USHRT_MAX
#define kInt32_Max LONG_MAX
#define kUInt32_Max ULONG_MAX
#define kInt64_Max  _I64_MAX
#define kUInt64_Max  (_UI64_MAX)
    
/* paths */
#define kEOLString "\r\n"
#define kPathDelimiterString "\\"
#define kPathDelimiterChar '\\'
#define kBadPathDelimiterStr "/"
#define kBadPathDelimiterChar '/'
#define kPartialPathBeginsWithDelimiter 0
  
    /* Includes */
    #include <windows.h>
    //#include <winsock2.h>
    //#include <mswsock.h>
    #include <process.h>
    //#include <ws2tcpip.h>
    #include <io.h>
    #include <direct.h>
    #include <errno.h>

    
    #define R_OK 0
    #define W_OK 1
        
    // POSIX errorcodes
    #define ENOTCONN 1002
    #define ECONNRESET 1003
    #define EADDRINUSE 1004
    #define EINPROGRESS 1007
    #define ENOBUFS 1008
    #define EADDRNOTAVAIL 1009

    /* Typedefs */
    typedef unsigned char       UInt8;
    typedef unsigned char       UChar;
    typedef signed char         Int8;
    typedef  char         Char;
    typedef unsigned short      UInt16;
    typedef signed short        Int16;
    typedef unsigned long       UInt32;
    typedef signed long         Int32;
    typedef LONGLONG            Int64;
    typedef ULONGLONG           UInt64;
    typedef float               Float32;
    typedef double              Float64;
	typedef UInt32				Bool;
	typedef UInt32        PointerSizedInt;


#endif

typedef Int32 OS_Error;

enum
{
    OS_NoErr = (OS_Error) 0,
	OS_Err   = (OS_Error) -1,
    OS_BadURLFormat = (OS_Error) -100,
    OS_NotEnoughSpace = (OS_Error) -101
};


// use no http/rtsp tspecial chars in kVersionString and kBuildString defines
#define kVersionString "1.0"
#define kBuildString "1.0"

#define kCommentString "Release/Panther; Update/3GPP; " 


#endif /* OSHeaders_H */
